/**
 * VUEshop
 * ============================================================================
 * * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.vueshop.com.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: soubao-java 2020-07-22 $
 */<template>
	<div>
		<el-form ref="form" :model="form" label-width="200px" label-position="right">
			<el-form-item label="是否启用二级域名">
				<el-switch v-model="form.enabled_subdomain" active-value="1" inactive-value="0"></el-switch>
			</el-form-item>
			<el-form-item label="是否可修改">
				<el-switch v-model="form.subdomain_edit" active-value="1" inactive-value="0"></el-switch>
				<p class="notic">不可修改时店主填写提交后将不可改动</p>
			</el-form-item>
			<el-form-item label="* 修改次数">
				<el-input v-model="form.subdomain_times"></el-input>
				<p class="notic">可修改时达到设定的次数后将不能再改动</p>
			</el-form-item>
			<el-form-item label="保留域名">
				<el-input v-model="form.site_domain"></el-input>
				<p class="notic">保留的二级域名，多个保留域名之间请用","隔开</p>
			</el-form-item>
			<el-form-item label="* 长度限制">
				<el-input v-model="form.subdomain_length"></el-input>
				<p class="notic">如"3-12"，代表注册的域名长度限制在3到12个字符之间</p>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="onSubmit">确认提交</el-button>
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				form: {},
			}
		},
		components: {

		},
		created() {
			this.getConfigs();

		},
		methods: {
			getConfigs() {
				var that = this
				this.request.get('/mall/configs', {
					params: {
						inc_type: 'subdomain',
					}
				}).then(function(res) {
					that.form = res.subdomain;
				})
			},
			onSubmit() {
				var that = this
				this.request.put('/mall/configs/subdomain', that.form).then(function(res) {
					if (res.status == 1) {
						that.$message({
							message: '保存成功',
							type: 'success'
						});
					} else {
						that.$message({
							showClose: true,
							message: '保存失败,失败原因:' + res.msg,
							type: 'error'
						});
					}
				})
			},
			changeWaterType() {

			},
		}
	}
</script>
<style scoped>


</style>
